@extends('default.layouts.simple_vice_head_foot')
@section('title'){{$find_jobEn.'_'.Site::get('webname')}} @endsection
@section('insert_css')
    {{--添加样式表--}}
    <link rel="stylesheet" href="{{asset('/default/css/index/vice_public.css')}}">
    <link rel="stylesheet" href="{{asset('/default/css/index/previewresume.css')}}">
    <link rel="stylesheet" href="{{asset('/vendor/jedate/skin/jedate.css')}}">
    <link rel="stylesheet" href="{{asset('/default/css/index/station.css')}}">

@endsection
@section('content')

    {{--副页菜单模版--}}
    @include('default.layouts.index_vice_mune')
    {{--分站列表--}}
    @include('default.layouts.station')
    {{--内容区显示区--}}
    <div class="vicecontent">
        {{--阴影线--}}
        <div class="shadow_line"></div>
        <div class="line20">&nbsp;</div>
        <div class="content border border_buttom_none">
            <div class="presumehead">
                <ul>
                    <li class="left">{{ trans('english.ResumeNumber') }}：{{ $reArrEn['id'] }}</li>
                    <li class="right">{{ trans('english.Recently') }}：{{ $reArrEn['lastlogintime'] }}</li>
                </ul>
            </div>
            {{--简历信息--}}
            <div class="resume">
                {{--头像与信息--}}
                <div class="frist">
                    <ul>
                        <li class="left">
                            <img src="{{asset($reArrEn['avatar'])}}">
                        </li>
                        <li class="right">
                            <ul class="son_ul">
                                <li class="list1 name">
                                    @if(!auth()->guard('company')->check())
                                        @if($reArrEn['sex'] == 'Man')
                                            {{ mb_substr($reArrEn['name'],0,12)}}Man
                                        @else
                                            {{ mb_substr($reArrEn['name'],0,12)}}Woman
                                        @endif
                                    @else
                                        {{ $reArrEn['name']}}
                                    @endif
                                </li>
                                <li class="list2 list">
                                    <i>{{ $reArrEn['sex']}}</i>|<i>{{ $reArrEn['birthday']}}</i>|<i>{{ $reArrEn['education']}}</i>|<i>{{ $reArrEn['work_year']}}</i>|<i>{{ $reArrEn['height'] }}</i>|<i>{{ $reArrEn['marital'] }}</i>
                                </li>
                                <li class="list3">
                                    <i>{{ trans('english.household') }}：<em>{{ $reArrEn['census'] }}</em></i>
                                    <i>{{ trans('english.NowLives') }}：<em>{{ $reArrEn['homeaddress'] }}</em></i>
                                </li>
                                <li class="list3">
                                    <i>Address：<em> @if(!empty($reArrEn['address'])){{ str_limit($reArrEn['address'],72 )}}@else{{ $reArrEn['homeaddress'] }}@endif</em></i>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
                {{--如果已查看过，显示联系方式--}}
                <div class="contactinfo">
                    @if($lookStatus == 3 )
                        <ul>
                            <li><span>{{ trans('english.contact') }}：<i>{{ $reArrEn['mobile']}}</i></span></li>
                            <li><span>{{ trans('english.emailAdd') }}：<i>{{ $reArrEn['email']}}</i></span></li>
                            <li><span>{{ trans('english.QQNumber') }} ：<i>{{ $reArrEn['qq']}}</i></span></li>
                        </ul>
                    @else(($lookStatus == 1 || $lookStatus == 2) && Auth::guard('company')->check() )
                        <ul>
                            <li><span>{{ trans('english.contact') }}：<i>{{ $reArrEn['mobile']}}</i></span></li>
                            <li><span>{{ trans('english.emailAdd') }}：<i>{{ $reArrEn['email']}}</i></span></li>
                            <li><span>{{ trans('english.QQNumber') }} ：<i>{{ $reArrEn['qq']}}</i></span></li>
                        </ul>
                    @endif
                </div>
                {{--按钮--}}
                @if($lookStatus != 3 )
                    <div class="second">
                        @if($lookStatus == 0)
                            <input type="button" value="{{ trans('english.Contact') }}" class="{{ $look_button }}">
                        @endif
                        <input type="button" value="{{ trans('english.Interview') }}" class="{{ $interview_button }}">
                        <input type="button" value="{{ $insertPersonnelLibrary_text }}"
                               class="{{ $insertPersonnelLibrary_button }}">
                        @if(Auth::guard('company')->check())
                            @if(Auth::guard('company')->user()->resumeNumber() > 1)
                                <input type="button" value="{{ trans('english.ResumeDown') }}" class="resumeDown">
                            @else
                                <input type="button" value="{{ trans('english.ResumeDown') }}" class="resumeBuy">
                            @endif
                        @endif
                    </div>
                @endif
                {{--求职意向--}}
                <div class="third">
                    <div class="title"><em></em><span>{{ trans('english.jobInTension') }}</span></div>
                    <dl>
                        <dt>{{ trans('english.HopeEngaged') }}：</dt>
                        <dd>{{ $reArrEn['intentionjobs'] }} | @if($reArrEn['isexpectedsalary'])
                                Negotiable@else{{ $reArrEn['expectedsalary'] }}@endif</dd>
                        <dt>{{ trans('english.workplace') }}：</dt>
                        <dd>{{ $reArrEn['jobarea'] }}</dd>
                        <dt>{{ trans('english.Expect') }}：</dt>
                        <dd>{{ $reArrEn['jobsort'] }}</dd>
                        <dt>{{ trans('english.JStatus') }}：</dt>
                        <dd>{{ $reArrEn['job_status'] }}</dd>
                    </dl>
                </div>
                {{--自我评价--}}
                @if(!empty($reArrEn['introduction']))
                    <div class="third">
                        <div class="title ico"><em></em><span>{{ trans('english.Self') }}</span></div>
                        <div class="info evaluation"><p>{!! nl2br(e($reArrEn['introduction'])) !!}</p></div>
                    </div>
                @endif
                {{--工作经历--}}
                @if(count($workExpArrEn) > 0)
                    <div class="third">
                        <div class="title ico2"><em></em><span>{{ trans('english.workExperience') }}</span></div>
                        @foreach($workExpArrEn as  $k=> $v)
                            <div class="info line @if($k==0) infoOne @elseif($k==count($workExpArr)-1) infoLast @endif">
                                <div class="time">{{$v['starttime']}}~{{$v['endtime']}}</div>
                                <div class="duties">
                                    <strong>{{$v['post']}}</strong><i>|</i><span>{{$v['company']}}</span>
                                </div>
                                <div class="duties">
                                    <span>{{$v['comkind']}}</span><i>-</i><span>{{$v['scale']}}</span><i>-</i><span>{{$v['industry']}}</span>
                                </div>
                                @if(!empty($v['content']))
                                    <div class="con"><p>{!! nl2br(e($v['content'])) !!}</p></div>  @endif
                            </div>
                        @endforeach
                    </div>
                @endif
                {{--教育经历--}}
                @if(count($eduExpArrEn) > 0)
                    <div class="third">
                        <div class="title ico3"><em></em><span>{{ trans('english.educate') }}</span></div>

                        @foreach($eduExpArrEn as  $k=> $v)
                            <div class="info line @if($k==0) infoOne @elseif($k==count($eduExpArr)-1) infoLast @endif">
                                <div class="time">{{$v['starttime']}}~{{$v['endtime']}}</div>
                                <div class="duties">
                                    @if($v['edu_type']=='1')
                                        <strong>{{$v['education']}}</strong>
                                    @elseif($v['edu_type']=='2')
                                        <strong>{{$v['speciality']}}</strong>
                                    @endif
                                    <i>|</i><span>{{$v['school']}}</span>
                                </div>
                                <div class="duties">
                                    @if($v['edu_type']=='1')
                                        <span>{{ trans('english.nameMajor') }}：</span><span
                                                class="served">{{$v['speciality']}}</span>
                                    @endif
                                </div>
                                @if(!empty($v['description']))
                                    <div class="con"><p>{!! nl2br(e($v['description'])) !!}</p></div>  @endif
                            </div>
                        @endforeach
                    </div>
                @endif
                {{--项目经验--}}
                @if(count($projectExpArr) > 0)
                    <div class="third">
                        <div class="title ico4"><em></em><span>{{ trans('english.project') }}</span></div>
                        @foreach($projectExpArr as  $k=> $v)
                            <div class="info line  @if($k==0) infoOne @elseif($k==count($projectExpArr)-1) infoLast @endif">
                                <div class="time">{{$v['starttime']}}~{{$v['endtime']}}</div>
                                <div class="duties">
                                    <strong>{{$v['project_name']}}</strong><i>|</i><span
                                            class="orange">{{ trans('english.holdOffice') }}：{{$v['post']}}</span>
                                </div>
                                @if(!empty($v['content']))
                                    <div class="con"><p>{!! nl2br(e($v['content'])) !!}</p></div>  @endif
                            </div>
                        @endforeach
                    </div>
                @endif
                {{--语言能力--}}
                @if(count($languageArrEn) > 0)
                    <div class="third">
                        <div class="title ico5"><em></em><span>{{ trans('english.language') }}</span></div>
                        <div class="info">
                            @foreach($languageArrEn as $v)
                                <div class="duties listItem">
                                    <strong>{{$v['language']}}</strong>
                                    <span class="degree">{{$v['degree']}}</span>
                                    @if(!empty($v['level']))<i>|</i><span>{{$v['level']}}</span>@endif
                                </div>
                            @endforeach
                        </div>
                    </div>
                @endif
                {{--技能专长--}}
                @if(count($skillArrEn) > 0)
                    <div class="third">
                        <div class="title ico6"><em></em><span>{{ trans('english.expertise') }}</span></div>
                        <div class="info">
                            @foreach($skillArrEn as $v)
                                <div class="duties listItem">
                                    <strong>{{$v['skillname']}}</strong>
                                    <span class="degree">{{$v['degree']}}</span>
                                </div>
                            @endforeach
                        </div>
                    </div>
                @endif
                {{--证书--}}
                @if(count($certificateArr) > 0)
                    <div class="third">
                        <div class="title ico7"><em></em><span>{{ trans('english.certificate') }}</span></div>
                        <div class="info">
                            @foreach($certificateArr as $v)
                                <div class="duties listItem">
                                    <strong>{{$v['certificate_name']}}</strong>
                                    <span class="degree">{{$v['gettime']}}{{ trans('english.received') }}</span>
                                </div>
                            @endforeach
                        </div>
                    </div>
                @endif
                {{--其它信息--}}
                @if(count($otherArr) > 0)
                    <div class="third">
                        <div class="title ico8"><em></em><span>{{ trans('english.otherInfo') }}</span></div>
                        @foreach($otherArr as  $k=> $v)
                            <div class="info">
                                <div class="other">
                                    <span>{{str_limit($v['title'],8)}}：</span>
                                    <p class="other">{!! nl2br(e($v['content'])) !!}</p>
                                </div>
                            </div>
                        @endforeach
                    </div>
                @endif
                {{--工作作品--}}
                @if(count($worksArr) > 0)
                    <div class="third ">
                        <div class="title ico9"><em></em><span>>{{ trans('english.work') }}</span></div>
                        <div class="listCon">
                            <ul>
                                @foreach($worksArr as $v)
                                    <li id="liCon{{$v['id']}}">
                                        <div class="workImg" id="workImg{{$v['id']}}">
                                            <input type="hidden" value="{{$v['id']}}">
                                            <input type="hidden" value="{{$v['works_name']}}">
                                            <input type="hidden" value="{{$v['description']}}">
                                            <span class="img"><a><img src="{{$v['imgurl']}}"></a></span>
                                            <span class="imgTit"><a>{{$v['works_name']}}</a> </span>
                                        </div>
                                    </li>
                                @endforeach
                            </ul>
                        </div>
                    </div>
                @endif
                <div class="line20"></div>
            </div>{{--end content--}}
        </div>
    </div>

    {{--按钮弹出对话框--}}
    <div class="eject">
        <div class="hide_box"></div>
        <div class="shang_box">
            <a class="shang_close" href="javascript:void(0)" title="{{ trans('english.close') }}"><img
                        src="{{asset('/default/images/index/close.jpg')}}" alt="{{ trans('english.cancel') }}"/></a>
            <div id="eject_content">
            </div>
        </div>
    </div>

    {{--浮动层--}}
    {{--右边浮动--}}
    @if(!empty($resumelist) && count($resumelist)>0)
        <div id="browse_resume" class="browse_resume">
            <ul>
                <li class="topTitle">{{ trans('english.library') }}</li>
                @foreach($resumelist as $k => $v)
                    @if($k<=10)
                        <li id="list{{ $k }}" class="resume_name @if($v->id == $id) resumecheck @endif"><a
                                    href="{{ $v->url }}"><span>{{ $v->name }}</span></a></li>
                    @endif
                @endforeach
                <li class="buttom">{{ trans('english.close') }}</li>
            </ul>
        </div>
    @endif
    {{--@include('default.layouts.floating')--}}
@endsection
@section('insert_js')
    <script type="text/javascript" src="{{ asset("/vendor/org/layer/layer.js") }}"></script>
    <script type="text/javascript" src="{{ asset("/default/js/index/ejectlogin.js") }}"></script>
    <script type="text/javascript" src="{{ asset("/default/js/jquery/jquery.validate.min.js") }}"></script>
    <script type="text/javascript" src="{{ asset("/default/js/jquery/jquery.form.js") }}"></script>
    <script type="text/javascript" src="{{ asset("/default/js/jquery/jquery.validate.extend.js") }}"></script>
    <script type="text/javascript" src="{{ asset("/default/js/jquery/jquery.jedate.js") }}"></script>
    <script type="text/javascript" src="{{ asset("/default/js/index/interview.js") }}"></script>
    <script type="text/javascript" src="{{ asset("/default/js/index/insertPersonnelLibrary.js") }}"></script>
    <script type="text/javascript">
        $(function(){
            //查看联系方式登录按钮
            $(".companylogin").click(function(){
                $.companyEject({
                    className: "companylogin",
                    csrf: "{{ csrf_token() }}",
                    QQLogin: "{{ Site::get('CompanyAppid') }}",
                    weiXin: "{{ Site::get('mpCompanyOpenAppID') }}",
                    weiXinUrl: "{{ weiXinlogin('company') }}",
                    callBack: function(status){
                        //alert(status);//422 密码错误，0成功，但目前做了 reload
                    }
                });
            });
            //面试邀请登录按钮
            $(".companylogin2").click(function(){
                $.companyEject({
                    className: "companylogin2",
                    csrf: "{{ csrf_token() }}",
                    QQLogin: "{{ Site::get('CompanyAppid') }}",
                    weiXin: "{{ Site::get('mpCompanyOpenAppID') }}",
                    weiXinUrl: "{{ weiXinlogin('company') }}",
                    callBack: function(status){
                    }
                });
            });
            //纳入人才库登录按钮
            $(".companylogin3").click(function(){
                $.companyEject({
                    className: "companylogin3",
                    csrf: "{{ csrf_token() }}",
                    QQLogin: "{{ Site::get('CompanyAppid') }}",
                    weiXin: "{{ Site::get('mpCompanyOpenAppID') }}",
                    weiXinUrl: "{{ weiXinlogin('company') }}",
                    callBack: function(status){
                    }
                });
            });
            //绑定查看联系方式
            $(".button1").click(function(){
                $.getContact({
                    userName: "{{ $reArrEn['name']}}",
                    url: "{{url('company/personcontact')}}",
                    crsf: "{{csrf_token()}}",
                    resumeId: "{{ $reArrEn['id'] }}",
                    callBack: function(status){
                        //alert(status);//0您的简历数已用尽，1显示联系方式成功2您的会员时间已过期
                    }
                });
            });
            //绑定面试邀请框
            $(".button2").click(function(){
                $.interview({
                    userName: "{{ $reArrEn['name']}}",
                    url: "{{url('company/inviteinterview')}}",
                    interviewUrl: "{{url('company/interviewnote')}}",
                    postJobUrl: "{{ url("company/jobpublish") }}",
                    crsf: "{{csrf_token()}}",
                    resumeId: "{{ $reArrEn['id'] }}",
                    callBack: function(status){
                        //alert(status);//0发布成功，1您今天已邀请过了，或未选择面试工作2企业未发布工作岗位
                    }
                });
            });
            //绑定纳入人才库
            $(".button3").click(function(){
                $.insertPersonnelLibrary({
                    userName: "{{ $reArrEn['name']}}",
                    url: "{{ route('toShowCompanyJobList') }}",
                    personnelLibraryUrl: "{{ route('insertPersonnelLibrary')}}",
                    postJobUrl: "{{ url("company/jobpublish") }}",
                    delPersonnelLibrary: "{{ route("delPersonnelLibrary") }}",
                    crsf: "{{csrf_token()}}",
                    resumeId: "{{ $reArrEn['id'] }}",
                    callBack: function(status){
                        //alert(status);//0发布成功，1您今天已邀请过了，或未选择面试工作2企业未发布工作岗位
                    }
                });
            });
            //简历下载
            $(".resumeDown").click(function(){
                window.location.href = "{{ route("resume.down",[$reArrEn['id']]) }}";
            });
            //询问是否购买简历数
            $(".resumeBuy").click(function(){
                resumeBuy = layer.confirm('Your membership has expired or your resume has been exhausted', {
                            btn: ['repurchase', 'Buy again later'] //按钮
                        },
                        function(){//success
                            //跳转到vip套餐页面
                            window.open("{{ route("myOrder.index") }}", "_blank");
                            layer.close(resumeBuy);
                            orderBuy = layer.confirm('Repurchase?', {
                                        btn: ['yes', 'Buy again later'] //按钮
                                    }, function(){
                                        window.location.reload();
                                    },
                                    function(){
                                        layer.close(orderBuy);
                                    }
                            );
                        },
                        function(){//false
                            layer.close(resumeBuy);
                        }
                );
            });
        });
        //设置更多值，重哪一个下标开始
        var moreIndex = 10;
        //右边浮动框
        var moreX = define_browse_resume()['x'];
        var fix_h = define_browse_resume()['y'];
        //多出的简历显示
        $(function(){
            userResumeNum = $("#browse_resume").find('li').length - 2;
            if(userResumeNum >= moreIndex){
                //取得更多的x,y位置
                var moreY = (fix_h + $("#browse_resume").height() - $(".buttom").height());
                $("#browse_resume").find('li').eq(userResumeNum).after("<li id='moreResume' class='resume_name' ><< 更多 </li>");
                jsName = "{{ $jsName }}";
                jsUrl = "{{ $jsUrl }}";
                jsId = "{{ $jsId }}";
                jsName = jsName.split('|');
                jsUrl = jsUrl.split('|');
                jsId = jsId.split('|');
                rHtml = "<ul id='moreUl' class='display_none'>";
                for(i = 0; i <= (jsName.length - 2); i++){
                    if(i > moreIndex){
                        if(jsId[i] == {{ $id }}){
                            rHtml += "<li class='resume_name resumecheck'><a href=" + jsUrl[i] + "><span>" + jsName[i] + "</span></a></li>";
                        }else{
                            rHtml += "<li class='resume_name'><a href=" + jsUrl[i] + "><span>" + jsName[i] + "</span></a></li>";
                        }
                    }
                }
                rHtml += "</ul>";
                $("#browse_resume").append(rHtml);
            }

            $("#moreResume").mouseover(function(){
                moreUlCss = $("#moreUl");
                moreUlCss.css("position", "fixed");
                moreUlCss.show();
                moreUlCss.mouseleave(function(){
                    moreUlCss.hide(300);
                });
                var offset = $("#moreResume").offset();
                moreUlCss.css("left", (offset.left - $("#browse_resume").width()) + "px");
                currentTop = offset.top - $(document).scrollTop();
                moreUlCss.css('top', currentTop - (parseInt(jsName.length - moreIndex - 3) * 25) - 2 + "px");
            });
        });

        function define_browse_resume(){
            var w = document.body.clientWidth;
            var h = $(window).height();
            fix_h = parseFloat(h / 3);
            var obj = $("#browse_resume");
            if(w > (999 + (obj.width() * 1.5)) + 15){//可视界面 如果大于1200+元素宽1.5倍
                fix_w = parseFloat((w - 999) / 2) + 999 + 15;
            }else{//小于则紧贴右边缘
                fix_w = parseFloat(w - obj.width());
            }
            obj.css("left", fix_w + "px");
            obj.css('top', fix_h + "px");
            XY = new Array();
            XY['x'] = fix_w;
            XY['y'] = fix_h;
            return XY;
        }
        window.onload = function(){
            window.onresize = define_browse_resume;
            define_browse_resume();
        }
        //调整浮动框大小
        $(".buttom").click(function(){
            var h = $(window).height();
            fix_h = parseFloat(h / 3);
            $(".resume_name").hide();
            ;
            $(".buttom").hide();
            ;
            $("#browse_resume").animate({top: (h - 25 + 'px')});
            $(".topTitle").html("<b id='open'>open</b>");
            $(".topTitle").find('#open').click(function(){
                $("#browse_resume").animate({top: (fix_h + 'px')});
                $(this).html("<b id='open'>resume</b>");
                $(".resume_name").show();
                $(".buttom").show();
            })
        });

        //轮播图片
        var photoJson = {!! $photoJson !!};
        @if(count($worksArr) > 0)
        @foreach($worksArr as $k => $v)
        //查看图片
        $("#workImg" + "{{$v['id']}}").find('.img').eq(0).click(function(){
            rotateImg(photoJson['{{$v['id']}}']);
        })
        @endforeach
        @endif
        function rotateImg(photoJson){
            layer.photos({
                photos: {
                    "title": '', //相册标题
                    "id": '', //相册id
                    "start": 0, //初始显示的图片序号，默认0
                    "data": photoJson
                },
                //显示关闭按钮
                closeBtn: 2,
                area: 'auto',
                //设置最大宽度
                maxWidth: '700',
                //是否显示拖拽
                move: false,
                //设置图片信息
                tab: function(pic, layero){
                    //console.log(pic) //当前图片的一些信息
                    $('.layui-layer-content').css({'border': '1px solid #444', 'padding': '10px'});
                }
                , shift: 5 //0-6的选择，指定弹出图片动画类型，默认随机
            });
        }

    </script>
@endsection
